﻿@model Role.Entity.Product
@{
    ViewBag.Title = "Details";
}
<h2>
    Details</h2>
<script src="@Url.Content("/Scripts/JwPlayer/swfobject.js")" type="text/javascript"></script>
<script src="@Url.Content("/Scripts/JwPlayer/jwplayer.js")" type="text/javascript"></script>
<fieldset>
    <legend>Product</legend>
    <div class="display-label">
        Name</div>
    <div class="display-field">@Model.Name</div>
    <div class="display-label">
        WorkFlowID</div>
    <div class="display-field">@Model.WorkFlowID</div>
    <div class="display-label">
        Info</div>
    <div class="display-field">@Model.Info</div>
</fieldset>
<div id="player">
</div>
<p>
    @Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
    @Html.ActionLink("Back to List", "Index")
</p>
<script type="text/javascript">
    $.ajax({
        url: "/product/GetFilePath?productID=@Model.ID",
        type: "GET", //GET必须将返回Json对象时开启选项才行，但GET可以配合JSONP实现跨域读数据
        success: function (data) {
            Page_Play(data.path);
        }
    });

    // FLV播放
    function Page_Play(url) {
        jwplayer('player').setup({
            flashplayer: '/Scripts/JwPlayer/player.swf',
            file: url,
            controlbar: 'bottom',
            width: 300,
            height: 300,
            image: '',
            autostart: true
        });
    }
</script>
